package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * ums_shipping_add实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class UmsShippingAdd implements Serializable{
	/***/
    @ApiModelProperty(value = "")
	private Integer id; 
	/**用户id*/
    @ApiModelProperty(value = "用户id")
	private Integer ueseId; 
	/**手机号码*/
	@NotBlank(message = "手机号码不可为空")
    @ApiModelProperty(value = "手机号码")
	private String phone; 
	/**姓名*/
    @NotBlank(message = "姓名不可为空")
    @ApiModelProperty(value = "姓名")
	private String name; 
	/**省份*/
    @NotBlank(message = "省份不可为空")
    @ApiModelProperty(value = "省份")
	private String province; 
	/**城市*/
    @NotBlank(message = "城市不可为空")
    @ApiModelProperty(value = "城市")
	private String city;
	/**区*/
    @NotBlank(message = "区不可为空")
    @ApiModelProperty(value = "区")
	private String area;
	/**详细地址*/
    @ApiModelProperty(value = "详细地址")
	private String address; 
	/**经度*/
    @ApiModelProperty(value = "经度")
	private String longitude; 
	/**纬度*/
    @ApiModelProperty(value = "纬度")
	private String latitude; 
	/**01-可用 02不可用*/
    @ApiModelProperty(value = "01-可用 02不可用")
	private String status; 
	/**true -默认 false-非默认*/
    @ApiModelProperty(value = "true -默认 false-非默认")
	private String defaultStatus; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**修改时间*/
    @ApiModelProperty(value = "修改时间")
	private Date updateTime; 
	/**
	 * 实例化
	 */
	public UmsShippingAdd() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public UmsShippingAdd(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("ueseId") instanceof Number) {
			this.setUeseId(((Number) obj.get("ueseId")).intValue());
		}
		if (obj.get("phone") instanceof String) {
			this.setPhone((String) obj.get("phone"));
		}
		if (obj.get("name") instanceof String) {
			this.setName((String) obj.get("name"));
		}
		if (obj.get("province") instanceof String) {
			this.setProvince((String) obj.get("province"));
		}
		if (obj.get("city") instanceof String) {
			this.setCity((String) obj.get("city"));
		}
		if (obj.get("area") instanceof String) {
			this.setArea((String) obj.get("area"));
		}
		if (obj.get("address") instanceof String) {
			this.setAddress((String) obj.get("address"));
		}
		if (obj.get("longitude") instanceof String) {
			this.setLongitude((String) obj.get("longitude"));
		}
		if (obj.get("latitude") instanceof String) {
			this.setLatitude((String) obj.get("latitude"));
		}
		if (obj.get("status") instanceof String) {
			this.setStatus((String) obj.get("status"));
		}
		if (obj.get("defaultStatus") instanceof String) {
			this.setDefaultStatus((String) obj.get("defaultStatus"));
		}
		this.setCreateTime((Date) obj.get("createTime"));
		this.setUpdateTime((Date) obj.get("updateTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getUeseId() != null) {
			result.put("ueseId",this.getUeseId());
		}
		if (this.getPhone() != null) {
			result.put("phone",this.getPhone());
		}
		if (this.getName() != null) {
			result.put("name",this.getName());
		}
		if (this.getProvince() != null) {
			result.put("province",this.getProvince());
		}
		if (this.getCity() != null) {
			result.put("city",this.getCity());
		}
		if (this.getArea() != null) {
			result.put("area",this.getArea());
		}
		if (this.getAddress() != null) {
			result.put("address",this.getAddress());
		}
		if (this.getLongitude() != null) {
			result.put("longitude",this.getLongitude());
		}
		if (this.getLatitude() != null) {
			result.put("latitude",this.getLatitude());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getDefaultStatus() != null) {
			result.put("defaultStatus",this.getDefaultStatus());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "UmsShippingAdd [id=" + id + " , ueseId=" + ueseId + " , phone=" + phone + " , name=" + name + " , province=" + province + " , city=" + city + " , area=" + area + " , address=" + address + " , longitude=" + longitude + " , latitude=" + latitude + " , status=" + status + " , defaultStatus=" + defaultStatus + " , createTime=" + createTime + " , updateTime=" + updateTime + "  ]";
	
	}
	
	
}
